]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenshot: Disable screencasts when locked
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 21 Aug 2022 18:59:25 +0000 (20:59 +0200)
committerMarge Bot <marge-bot@gnome.org>
Mon, 22 Aug 2022 14:15:17 +0000 (14:15 +0000)
It is currently not possible to bring up the screenshot UI while
locked, but that is about to change.

We still don't want screencasts in that case, because they are
much easier to abuse for filling up someone else's disk.

That restriction is enforced by inhibiting remote access in the
backend, so trying to create a screencast session will fail anyway.
Still, not offering an action that is unavailable is better than
having it fail silently, so do exactly that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2439>

data/theme/gnome-shell-sass/widgets/_screenshot.scss
js/ui/screenshot.js

index f7fa3da2bef8ca241d61675d7ea7517a8e9676d6..150f273b4256d216d70321fb9b9460989d33b2fa 100644 (file)
@@ -98,6 +98,7 @@ $screenshot_ui_button_red: $error_color;
   &:hover, &:focus { background-color: lighten($osd_bg_color, 10%);}
   &:active { background-color: lighten($active_bg_color,5%);}
   &:checked { background-color: white;color: black;}
+  &:insensitive { color: transparentize($osd_fg_color, 0.5);}
 
   border-radius: $modal_radius - $screenshot_ui_shot_cast_spacing;
 
index 931f9583190dc739c121ee472301fd87557bdf42..d82d7a7a62475891fe379c6fbb7145019a268bd0 100644 (file)
@@ -1021,8 +1021,6 @@ var ScreenshotUI = GObject.registerClass({
 
         this._lockdownSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.lockdown' });
 
-        Main.sessionMode.connect('updated', () => this.close(true));
-
         // The full-screen screenshot has a separate container so that we can
         // show it without the screenshot UI fade-in for a nicer animation.
         this._stageScreenshotContainer = new St.Widget({ visible: false });
@@ -1343,6 +1341,15 @@ var ScreenshotUI = GObject.registerClass({
                 }
             }
         );
+
+        Main.sessionMode.connect('updated',
+            () => this._sessionUpdated());
+        this._sessionUpdated();
+    }
+
+    _sessionUpdated() {
+        this.close(true);
+        this._castButton.reactive = Main.sessionMode.allowScreencast;
     }
 
     _refreshButtonLayout() {